package com.xbongbong.pro.message.pushset;/*/*/

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.message.domain.entity.PushSetEntity;
import com.xbongbong.pro.constant.CommonConstant;
import com.xbongbong.pro.message.base.AbstractPushSet;
import com.xbongbong.pro.message.constant.PushSetConstant;
import com.xbongbong.pro.message.enums.PushObjectTypeEnum;
import com.xbongbong.pro.message.enums.PushTypeEnum;
import com.xbongbong.pro.message.model.PushSetModel;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Description: 工单推送设置
 * @author 魏荣杰
 * @date 2018/7/19 15:34
 * @version v3.25
 * @since v3.25
 * Modified by:
 */
public class WorkOrderPushSet extends AbstractPushSet {

    private String pushObject;

    public String getPushObject() {
        return pushObject;
    }

    public void setPushObject(String pushObject) {
        this.pushObject = pushObject;
    }

    @Override
    public PushSetEntity toPushSetEntity(String pushObject, String pushTime, String attrEntity) {
        setPushObject(pushObject);

        PushSetEntity pushSetEntity = new PushSetEntity();

        pushSetEntity.setAddTime(addTime);
        pushSetEntity.setAttrEntity(attrEntity);
        pushSetEntity.setCorpid(corpid);
        pushSetEntity.setDel(del);
        pushSetEntity.setEnable(enable);
        pushSetEntity.setId(id);
        pushSetEntity.setPushObject(pushObject);
        pushSetEntity.setPushTime(pushTime);
        pushSetEntity.setRefEntity(refEntity);
        pushSetEntity.setSubType(subType);
        pushSetEntity.setType(type);
        pushSetEntity.setUpdateTime(updateTime);

        return pushSetEntity;
    }

    @Override
    public PushSetEntity getPushSet(String corpid, Integer subType, PushSetModel pushSetModel) {
        Integer type = XbbRefTypeEnum.WORK_ORDER.getCode();

        Map<String, Object> param = new HashMap<>(16);
        param.put("corpid", corpid);
        param.put("type", type);
        param.put("subType", subType);
        List<PushSetEntity> pushSetEntityList = pushSetModel.findEntitys(param);

        PushSetEntity pushSetEntity;
        if (pushSetEntityList.isEmpty()) {
            pushSetEntity = new PushSetEntity();
            pushSetEntity.setType(type);
            //默认都开启推送
            pushSetEntity.setEnable(1);
            pushSetEntity.setSubType(subType);
            JSONObject pushObject = new JSONObject();
            if (subType.equals(PushTypeEnum.WORKORDER_NEW_EXECUTOR.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_NEW_EXECUTOR.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_NEW_EXECUTOR));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                List<Integer> managerList = new ArrayList<>();
                managerObject.put("value", managerList);
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                List<Integer> userList = new ArrayList<>();
                userObject.put("value", userList);
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_NEW_EXECUTED.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_NEW_EXECUTED.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_NEW_EXECUTED));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 0);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 1);
                JSONArray managerArray = new JSONArray();
                JSONObject valueObj = new JSONObject();
                valueObj.put("id", "1");
                valueObj.put("name", I18nMessageUtil.getMessage(CommonConstant.FIRST_LEVEL_SUPERVISOR));
                managerArray.add(valueObj);
                managerObject.put("value", managerArray);
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_CONFIRM.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_CONFIRM.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_CONFIRM));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 0);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_TEAM.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_TEAM.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_TEAM));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 1);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_STAGE_COMPLETE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_STAGE_COMPLETE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_STAGE_COMPLETE));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 0);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_COMPLETE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_COMPLETE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_COMPLETE));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 0);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_CLOSE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_CLOSE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_CLOSE));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_RESTART.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_RESTART.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_RESTART));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 0);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_TRANSFER.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_TRANSFER.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_TRANSFER));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 0);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_ROLLBACK.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_ROLLBACK.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_ROLLBACK));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 0);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            } else if (subType.equals(PushTypeEnum.WORKORDER_DEL_PUSH.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_DEL_PUSH.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_DELETE));
                //type
                JSONArray typeArray = new JSONArray();
                JSONObject typeObject = new JSONObject();
                typeObject.put("name", PushObjectTypeEnum.CREATOR.getName());
                typeObject.put("enable", 1);
                typeObject.put("alias", PushObjectTypeEnum.CREATOR.getAlias());
                typeArray.add(typeObject);
                JSONObject typeObject1 = new JSONObject();
                typeObject1.put("name", PushObjectTypeEnum.MAINUSER.getName());
                typeObject1.put("enable", 1);
                typeObject1.put("alias", PushObjectTypeEnum.MAINUSER.getAlias());
                typeArray.add(typeObject1);
                JSONObject typeObject2 = new JSONObject();
                typeObject2.put("name", PushObjectTypeEnum.COLLABORATOR.getName());
                typeObject2.put("enable", 0);
                typeObject2.put("alias", PushObjectTypeEnum.COLLABORATOR.getAlias());
                typeArray.add(typeObject2);
                JSONObject typeObject3 = new JSONObject();
                typeObject3.put("name", PushObjectTypeEnum.COPYER.getName());
                typeObject3.put("enable", 0);
                typeObject3.put("alias", PushObjectTypeEnum.COPYER.getAlias());
                typeArray.add(typeObject3);
                JSONObject typeObject4 = new JSONObject();
                typeObject4.put("name", PushObjectTypeEnum.CUSTOMERMAINUSER.getName());
                typeObject4.put("enable", 0);
                typeObject4.put("alias", PushObjectTypeEnum.CUSTOMERMAINUSER.getAlias());
                typeArray.add(typeObject4);
                JSONObject typeObject5 = new JSONObject();
                typeObject5.put("name", PushObjectTypeEnum.CONTRACTMAINUSER.getName());
                typeObject5.put("enable", 0);
                typeObject5.put("alias", PushObjectTypeEnum.CONTRACTMAINUSER.getAlias());
                typeArray.add(typeObject5);
                pushObject.put("type", typeArray);
                //manager
                JSONObject managerObject = new JSONObject();
                managerObject.put("enable", 0);
                managerObject.put("value", new ArrayList<>());
                pushObject.put("manager", managerObject);
                //user
                JSONObject userObject = new JSONObject();
                userObject.put("enable", 0);
                userObject.put("value", new ArrayList<>());
                pushObject.put("user", userObject);

            }
            pushSetEntity.setPushObject(pushObject.toJSONString());
            pushSetEntityList.add(pushSetEntity);
        } else {
            pushSetEntity = pushSetEntityList.get(0);
            if (subType.equals(PushTypeEnum.WORKORDER_NEW_EXECUTOR.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_NEW_EXECUTOR.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_NEW_EXECUTOR));

            } else if (subType.equals(PushTypeEnum.WORKORDER_NEW_EXECUTED.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_NEW_EXECUTED.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_NEW_EXECUTED));

            } else if (subType.equals(PushTypeEnum.WORKORDER_CONFIRM.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_CONFIRM.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_CONFIRM));

            } else if (subType.equals(PushTypeEnum.WORKORDER_TEAM.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_TEAM.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_TEAM));

            }  else if (subType.equals(PushTypeEnum.WORKORDER_STAGE_COMPLETE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_STAGE_COMPLETE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_STAGE_COMPLETE));

            } else if (subType.equals(PushTypeEnum.WORKORDER_COMPLETE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_COMPLETE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_COMPLETE));

            } else if (subType.equals(PushTypeEnum.WORKORDER_CLOSE.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_CLOSE.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_CLOSE));

            } else if (subType.equals(PushTypeEnum.WORKORDER_RESTART.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_RESTART.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_RESTART));

            } else if (subType.equals(PushTypeEnum.WORKORDER_TRANSFER.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_TRANSFER.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_TRANSFER));

            } else if (subType.equals(PushTypeEnum.WORKORDER_ROLLBACK.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_ROLLBACK.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_ROLLBACK));

            } else if (subType.equals(PushTypeEnum.WORKORDER_DEL_PUSH.getSubCode())) {
                pushSetEntity.setTitle(PushTypeEnum.WORKORDER_DEL_PUSH.getName());
                pushSetEntity.setContent(I18nMessageUtil.getMessage(PushSetConstant.WORKORDER_DELETE));

            }
        }
        return pushSetEntity;
    }

    @Override
    public PushSetEntity getPushSet(String corpid, String attr, PushSetModel pushSetModel) {
        return null;
    }

    @Override
    public List<PushSetEntity> getPushSet(String corpid, List<String> attrList, PushSetModel pushSetModel, Long templateId) {
        return null;
    }

    @Override
    public JSONObject getTimeJson(JSONObject jsonObject) {
        return new JSONObject();
    }

}
